#include <iostream>
#include "Matrix.h"

/**
 * @file   main.cpp
 * @author Harrior
 * @date   Thu Oct  7 23:10:18 2021
 * 
 * @brief  This is a test file for Matrix.h, it will test the function 'is_square()' and the multiplication.
 * Besides, it will test one error case.
 * 
 * 
 */

int main()
{
    int m,n;

    //test  for is_square();
    //create Matrix a,b,c,d
    std::cin >> m;
    std::cin >> n;
    Matrix<double> a(m,n);
    std::cin >> m;
    std::cin >> n;
    Matrix<double> b(m,n);
    std::cin >> m;
    std::cin >> n;
    Matrix<double> c(m,n);
    std::cin >> m;
    std::cin >> n;
    Matrix<double> d(m,n);

    if(a.is_square())
	      std::cout << "a is square" << std::endl;
    else
	      std::cout << "a is not square" << std::endl;

    if(b.is_square())
        std::cout << "b is square" << std::endl;
    else
	      std::cout << "b is not square" << std::endl;

    //test the multiplication * of matrix in m!=n;
    Matrix<double> tes1;
    tes1 = a * b;
    tes1.printMatrix();

    //test the multipulication * between ColVectors;
    std::cin >> n;
    ColVector<double> C1(n);
    ColVector<double> C2(n);
    double test;
    test = C1 * C2;
    std::cout << "the test is " << test << std::endl;

    //test the multipulication * between RowVectors;
    std::cin >> n;
    RowVector<double> R1(n);
    RowVector<double> R2(n);
    test = R1 * R2;
    std::cout << "the row test result is " << test << std::endl;

    //test the multipulication * between RowVector and ColVector
    std::cout << "the row and col result is " << R1 * C2 << std::endl;
    
    //test the multipulication * between ColVector and RowVector
    tes1 = C2 * R1;
    std::cout << "the col and row test result is" << std::endl;
    tes1.printMatrix();

    //test error
    tes1 = b * a;
    return 0;
}
